<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    console.log(1+'2') //12
    var obj = {
      valueOf() {
        return 100
      },toString() {
        return '200'
      }
    }
    console.log(obj + 10) //110 会先执行valueOf方法，如果返回的是基本类型将不会再执行toString方法

    var obj2 = {
      valueOf() {
        return new Object()
      },toString() {
        return '200'
      }
    }

    console.log(obj2 + 10) // 20010
  </script>
</body>
</html>